package code.tools.behavior.achieve
{
	import code.main.App;
	import code.tools.behavior.IDisappear;
	
	import com.greensock.TweenLite;
	import com.greensock.easing.Back;
	import com.greensock.plugins.VisiblePlugin;
	
	import flash.display.Sprite;

	/**
	 *面板从屏幕中央瞬移到屏幕左侧外消失 
	 * @author liangqian
	 * 
	 */	
	public class DisappearMove implements IDisappear
	{
		/**
		 * 面板引用
		 */
		private var _mPanel:Sprite;
		/**
		 * 面板出现后执行的操作
		 */
		private var _callBack:Function;
		public function DisappearMove(_mPanel:Sprite, callback:Function = null) 
		{
			this._mPanel = _mPanel;
			this._callBack = callback;
		}
		
		public function disappear():void
		{
			if (_callBack != null)
				TweenLite.to(_mPanel, 0.5, { x:-App.appstage.stageWidth*.5, ease:Back.easeIn, onComplete:_callBack } );
			else
				TweenLite.to(_mPanel, 0.5, { x:-App.appstage.stageWidth*.5, ease:Back.easeIn } );
		}
	}
}